UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CtfjirI6n+gMpsiPLaEheIUkXVHazhdD1vOiJegTbE4='
WHERE
key_id = 'c202de7205c6fb253fdf394eeb85de9604327ab1cf481dbb06d1248ff140ce31'
AND (
token = 'CtfjirI6n+gMpsiPLaEheIUkXVHazhdD1vOiJegTbE4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)