UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AhDDn5kBHwxD93yvReZZAitL/GrybRivk82EGvA2a0k='
WHERE
key_id = '6308753b9fd12e81e6c9a6127c77f5118fc03b8f3d5baf03213e15175d1c3249'
AND (
token = 'AhDDn5kBHwxD93yvReZZAitL/GrybRivk82EGvA2a0k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)