UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gHj446iPNtFljJag7tkuBijVO0QJ+DHk4CXwdwlykS4='
WHERE
key_id = '3badcddc2d43ac0e1cb667e54e371a0cc34b7f1c90c0e291669f1c473f1e4a0d'
AND (
token = 'gHj446iPNtFljJag7tkuBijVO0QJ+DHk4CXwdwlykS4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)