UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ay0ykq2CtOQECvPwI/SnAFBT9fNkUpsjkTbJXAigh+4=' 
WHERE 
  key_id = 'afbd4f562f36ad633737840a26918d8f3f36ec6ff4044f35efac286e822624cc' 
  AND (
    token = 'ay0ykq2CtOQECvPwI/SnAFBT9fNkUpsjkTbJXAigh+4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017