UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MFUdzBH78j74+eYHPLETFNZomyU4W4M4cpy32kgOJL0='
WHERE
key_id = 'bbc21d7e4094cbdf1f23ee9107d5597aa35fb4811ab39e6245da5fdbcab0a19d'
AND (
token = 'MFUdzBH78j74+eYHPLETFNZomyU4W4M4cpy32kgOJL0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)