UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'X2d+3a99bpCjVllTE17vmiM1q0nwrbCABU88QoZ38Js=' 
WHERE 
  key_id = '08641db4c76c814d03cb3fc8c54a98575c6a566d32a54c396ead1d131ca6578e' 
  AND (
    token = 'X2d+3a99bpCjVllTE17vmiM1q0nwrbCABU88QoZ38Js=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023