UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'f7dbFWX6V8zMywLV341/ZI/QamPpRZ90qcqotu/Fah8=' 
WHERE 
  key_id = 'effdf2f86d01033d064cee27414d0f92681778bbbab32e69b0e33824babfd6c8' 
  AND (
    token = 'f7dbFWX6V8zMywLV341/ZI/QamPpRZ90qcqotu/Fah8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033