UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0X11RDR1jOACQDksSDzG4exGgJ7irQWd9UbsuhvbEW8='
WHERE
key_id = 'ad37469389101e33e56b9686608b06fbb770f7db2c893b68ee348020a13021ac'
AND (
token = '0X11RDR1jOACQDksSDzG4exGgJ7irQWd9UbsuhvbEW8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)