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