UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LCTCJLmvyopYc5C3TGJMYYNv9zBoaq6Owbs+Ec/b//4=' 
WHERE 
  key_id = 'd267bb07f4024fd33a10f3061ee3c403bc0b88354b5f0ff57e8c48234af92ab3' 
  AND (
    token = 'LCTCJLmvyopYc5C3TGJMYYNv9zBoaq6Owbs+Ec/b//4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050