UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'WRPnajFO+QE0usezZQDJCVNysqJ4tr1K+VyRE3g4MMU='
WHERE
key_id = 'b770f1b5987c0b5b41cedff187e1dfa635a7300b66062189905a8c25278f6761'
AND (
token = 'WRPnajFO+QE0usezZQDJCVNysqJ4tr1K+VyRE3g4MMU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)