UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oCXvKtt/9gb64QfvIhhCSIl27LzscHnPRB4MbWWEJTI='
WHERE
key_id = 'a312d7b09e0be973051d9b033db5b5783f3f3aca6d2af03db8413baa8404ba36'
AND (
token = 'oCXvKtt/9gb64QfvIhhCSIl27LzscHnPRB4MbWWEJTI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)