UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wk7dGdfJPCo8vCuBtT+q/pYnUrRzFDPgWpVm5JIWRUc=' 
WHERE 
  key_id = 'be4b23c4b337ab44ad510817d2298af238df8b39f4461561c24364ee7d4b1bde' 
  AND (
    token = 'wk7dGdfJPCo8vCuBtT+q/pYnUrRzFDPgWpVm5JIWRUc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034