UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'M/m4VFwMHKkNTYS2vWYnhm0ki0IT34CREC1d8v9Vve8='
WHERE
key_id = 'f11ea400384dfd57a4b0b12d760bfd5b3959c6fd44a8eb391d040e00e6e71dbc'
AND (
token = 'M/m4VFwMHKkNTYS2vWYnhm0ki0IT34CREC1d8v9Vve8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)