UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9NBjD/zpL96ahc6lj4/E6kTRJO2wxft5V9+U5M5lwZk='
WHERE
key_id = '8068e0700ef2b8eee38e76b3fade3b59a7b437a082e36518cabab1aad7a863b9'
AND (
token = '9NBjD/zpL96ahc6lj4/E6kTRJO2wxft5V9+U5M5lwZk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)