UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fI9Nd0zgnW1uqhnyKAGHNVRpRGaUR4A37eQ1v2sjphg='
WHERE
key_id = 'b949eb5c84eb82ac23a9055586bf12f83c8831536e8c7a9d1c7002c674b32b2e'
AND (
token = 'fI9Nd0zgnW1uqhnyKAGHNVRpRGaUR4A37eQ1v2sjphg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)