UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SmjtiZD2mIBCm6dxvgjqMuLkFzjdW7y6N46uh5jX5bo='
WHERE
key_id = '8532a72ddc0655ed6acde27a4878bcd4d9f095b2085f792621944abf1a146d5f'
AND (
token = 'SmjtiZD2mIBCm6dxvgjqMuLkFzjdW7y6N46uh5jX5bo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)