UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YKRVJcy8l4F9VuO7pQSWtkdmyV3Wow0undzAr/d4G78='
WHERE
key_id = '02b94cb08f5bc64e8803f57d25f5d236255ae151d3e6b14f00acc0b3d90b52b0'
AND (
token = 'YKRVJcy8l4F9VuO7pQSWtkdmyV3Wow0undzAr/d4G78='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)