UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4cSWDgfLswkghwxmss/JX0aeJwAkue6HyA0Z/r+ABv0='
WHERE
key_id = '58c9a73e50347261fccce883fc21ce2fa9f3d721338bc3be5e5ee309693c565e'
AND (
token = '4cSWDgfLswkghwxmss/JX0aeJwAkue6HyA0Z/r+ABv0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)