UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BvP/GjAlXzRimrnZ90aTPEYt7b+Ia/eTeB++tm5i3DI=' 
WHERE 
  key_id = 'a7b1d609147e37bb7f30a81d2de6697fc85da36111395fa2012d8e56ba6726a1' 
  AND (
    token = 'BvP/GjAlXzRimrnZ90aTPEYt7b+Ia/eTeB++tm5i3DI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036