UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Zhh8piALgdpi3YoAh2jG6EBdxpWl1Osn0O0Lx2Ka3Y4=' 
WHERE 
  key_id = 'a1ae59bb614aa8655b4ee2ac9490267ea594cd470a302e0665e81cd9fbafb59c' 
  AND (
    token = 'Zhh8piALgdpi3YoAh2jG6EBdxpWl1Osn0O0Lx2Ka3Y4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041