UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YMJgSX7l4IM8m2j8p1Cw8R1N9lbGxt2SUa3x8gVwyT8=' 
WHERE 
  key_id = '4bd0d165f4e6a891618497c1d860039b1a9e23d329ff0136a37ce2ae8c3b3345' 
  AND (
    token = 'YMJgSX7l4IM8m2j8p1Cw8R1N9lbGxt2SUa3x8gVwyT8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031