UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gjiRWIcZDplzbY+xcVJN8Ge3OSklb8YGFhlEDgnreF4='
WHERE
key_id = '28ba638a95d2e10da15d798a5b32960845f989b83cc5f4e6cd00ea77c177a420'
AND (
token = 'gjiRWIcZDplzbY+xcVJN8Ge3OSklb8YGFhlEDgnreF4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)