UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'F2QcQptIGRlvShmdqScOw9QXREnbkVFL30wdx05Fb1w=' 
WHERE 
  key_id = 'f1c729de580120fd90fbd41a937011372784655cd1649ac82e01a58aa5b71e4e' 
  AND (
    token = 'F2QcQptIGRlvShmdqScOw9QXREnbkVFL30wdx05Fb1w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036