UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bEejn6qmmkdglGt+emNZPKGnWIfdhXc3JSKXPDqmSVw='
WHERE
key_id = 'a475b8aae0ef855ccdee64b19b3ad3752d97fd6b3bf0ce12ecba623f2cdd1ef6'
AND (
token = 'bEejn6qmmkdglGt+emNZPKGnWIfdhXc3JSKXPDqmSVw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)