UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+9RTIHswshe5pUKR77yqUqBLYx46HvoQ2NxvmKkkY5M=' 
WHERE 
  key_id = 'e074c1801a5818a2ac6c69e97898493acd92c4f7f4b076aeedc8048c486f7455' 
  AND (
    token = '+9RTIHswshe5pUKR77yqUqBLYx46HvoQ2NxvmKkkY5M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032