UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TmDqBZAlCdIRvNGMkD+ajU9DbCExM7/89YeTl6smmBs='
WHERE
key_id = 'e6e6a61c8db6dd57ac76d7aaed6e89ea9feacaa8d8e48d1b22ee299945d506c6'
AND (
token = 'TmDqBZAlCdIRvNGMkD+ajU9DbCExM7/89YeTl6smmBs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)