UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JnUykpCQpOJ4AC5/2/QXe3pOCrIokKFLXrP4uqm1rsY=' 
WHERE 
  key_id = 'f1446840deea30e5ebbca6064fd308fcc173f35af232b737bb7301a091c1a356' 
  AND (
    token = 'JnUykpCQpOJ4AC5/2/QXe3pOCrIokKFLXrP4uqm1rsY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048