UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YuHFFh5amW5GxIL6epcbQbo2FSBbJrREys0ph+OiiEU='
WHERE
key_id = 'd8e215befea41c2f0cfa87deb7e5c5a51e1efc282634a69677b83de31a4bf553'
AND (
token = 'YuHFFh5amW5GxIL6epcbQbo2FSBbJrREys0ph+OiiEU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)