UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kZghKk5CMWKNLdvfdNcVLIV5vOE/xIdviEtXfE233p0='
WHERE
key_id = '8a213635cf0c668a6e34630569f4191947f276eff81c1152dafadaf75ca4a302'
AND (
token = 'kZghKk5CMWKNLdvfdNcVLIV5vOE/xIdviEtXfE233p0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)