UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Bm2o/ENb8jf7fgdbMxVXumNBsMPXn3cHZXNVJjuzvz8='
WHERE
key_id = 'a996405f0cf283ec28aec914982bdb583702a7f060153d1870bd05b69bae743f'
AND (
token = 'Bm2o/ENb8jf7fgdbMxVXumNBsMPXn3cHZXNVJjuzvz8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)