UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gW4pyOFXGahloh36ccODuzDMnkHmwzq0PaJc30vu7FA=' 
WHERE 
  key_id = 'f639878c4a2a173ab24b201ad7277bad100e7968a083ea7db384fa1bbab26e1d' 
  AND (
    token = 'gW4pyOFXGahloh36ccODuzDMnkHmwzq0PaJc30vu7FA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043