UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fBEhbfPQW4fVXf90izWIECEE4Y4i7XBSJp+3VQiJA0w='
WHERE
key_id = 'c14620737ccc84f927b4883efd806ec1425f6d02af8caf30a82e1b53e27770c6'
AND (
token = 'fBEhbfPQW4fVXf90izWIECEE4Y4i7XBSJp+3VQiJA0w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)