UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XTJd1WgI54JdRWi9ghGU0yeEqASzdN3R25FcuBzYRtU='
WHERE
key_id = '52896f2ba1cd78574da9c37ace9f4f343d8a7be98b202082e2b53c38034dfc41'
AND (
token = 'XTJd1WgI54JdRWi9ghGU0yeEqASzdN3R25FcuBzYRtU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)