UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6oiaDzB2fzg8Ay/6CGYQBH/ipMHKzuLIdsZobCpAF4c='
WHERE
key_id = 'cfff7f08610717415548bc2a307885b126fc5c90b9e2c798cc8cc5cdac77221a'
AND (
token = '6oiaDzB2fzg8Ay/6CGYQBH/ipMHKzuLIdsZobCpAF4c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)