UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nMWbqILmZfDdbHXmh6Hjxpnxmev+cNINIY/gH3bGtPk='
WHERE
key_id = 'f4bff85b30f7c5a40f1d14100979884193cb79c830c0fe9c435fdc215867e07e'
AND (
token = 'nMWbqILmZfDdbHXmh6Hjxpnxmev+cNINIY/gH3bGtPk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)