UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oQCONeD8ipjmGuOaC3nMO7W7AMyrWkwUzV5GYMvLSQM='
WHERE
key_id = 'b91b7fa41b675a7986eb4ba0f05a585a05b713800ad5c4940396c6df3e6f6105'
AND (
token = 'oQCONeD8ipjmGuOaC3nMO7W7AMyrWkwUzV5GYMvLSQM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)